Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change iteration over GAP objects #1057

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

ThomasBreuer
Copy link
Member

- omit holes when iterating over GAP lists
- extend documentation
- fix a GAPDoc error in the JuliaInterface manual
Copy link

codecov bot commented Oct 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.92%. Comparing base (5ba3c3f) to head (5555e51).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1057      +/-   ##
==========================================
- Coverage   74.98%   74.92%   -0.07%     
==========================================
  Files          55       55              
  Lines        4549     4554       +5     
==========================================
+ Hits         3411     3412       +1     
- Misses       1138     1142       +4     
Files with missing lines Coverage Δ
pkg/JuliaInterface/gap/JuliaInterface.gd 100.00% <ø> (ø)
src/adapter.jl 73.63% <100.00%> (+1.25%) ⬆️

... and 1 file with indirect coverage changes

The effect of this missing declaration was strange:
I did not get error messages when trying `include("test/runtests.jl")`,
but the CI tests showed the GAP warning
together with an (intended) error message,
which caused a different output there and hence a test failure.
@@ -496,7 +495,12 @@ end

function Base.iterate(obj::GapObj, (i, len)::Tuple{Int,Int})
i > len && return nothing
ElmList(obj, i), (i+1, len)
res = ElmList(obj, i)
while res === nothing # dangerous if `len` is *larger* than the length
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible for a GAP iterator to have holes at the end? If yes, this may be an infinite loop.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The length is the position of the last bound element. Thus it is safe to call the function with the correct len.

However, if one deliberately enters a too big len and i is not larger than len but already larger than the length then one enters the while loop, and this loop will be infinite.

@fingolfin fingolfin merged commit 5cbad84 into oscar-system:master Oct 21, 2024
21 checks passed
@ThomasBreuer ThomasBreuer deleted the TB_iterate branch October 21, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Skip holes when iterating over GAP lists?
3 participants